package meijuli.com.join51.business.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import meijuli.com.join51.business.R;
import meijuli.com.join51.business.fragment.WithDrawFragment;
import meijuli.com.join51.business.model.BankMsg;
import meijuli.com.join51.business.model.Wallet;

/**
 * 提现！！！
 *
 * @author wenqin 2017-05-05 17:28
 */

public class WithDrawActivity extends BaseActivity {
    public static final String KEY_BANK_MSG = "key_bank_msg";
    TextView mToolbarTitle;
    Toolbar mToolbar;
    TextView mMenuText;

    public static void start(Activity activity, BankMsg bankMsg) {
        Intent intent = new Intent(activity, WithDrawActivity.class);
        intent.putExtra(KEY_BANK_MSG, bankMsg);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base_fragment);
        mToolbarTitle = findViewById(R.id.toolbar_title);
        mToolbar = findViewById(R.id.toolbar);
        mMenuText = findViewById(R.id.text_menu);
        initToolBar();

        BankMsg bankMsg = (BankMsg) getIntent().getSerializableExtra(KEY_BANK_MSG);

        addFragment(WithDrawFragment.newInstance(bankMsg));


    }

    private void initToolBar() {
        mToolbar.setTitle("");
        mToolbarTitle.setText("提现");
        mMenuText.setText("提现明细");
        mMenuText.setVisibility(View.VISIBLE);
        mToolbar.setNavigationIcon(R.mipmap.icon_back_white);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!getSupportFragmentManager().popBackStackImmediate()) {
                    finish();
                }
            }
        });
        mMenuText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               FlowActivity.start(WithDrawActivity.this, Wallet.TYPE_WITHDRAW);
            }
        });
    }
}
